package com.example.stu.aimport;

import com.example.stu.mapper.ManagerMapper;
import com.example.stu.pojo.ManagerLogin;
import com.example.stu.pojo.Student;
import com.example.stu.service.StudentService;
import org.apache.catalina.Manager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * @Date: 2021/3/4
 * @Author: 黄先军
 * @Description:
 */
@RestController
@RequestMapping("/import")
public class StudentImportController {
    @Autowired
    private StudentService studentService;

    @Resource
    private ManagerMapper managerMapper;

    @RequestMapping("saveOrUpdate")
    public void saveOrUpdate( ){

        int stuid = 2111030011;
        String stuidcardfirst = "5130211998010";
        String name = "张三";
        int stuidcardend = 10001;

        Student s = new Student();
        for(int i=0;i<=10;i++){
            stuidcardend = stuidcardend+1;
            String stuidcard = stuidcardfirst + stuidcardend;
            //学号
            s.setStuId(stuid);
            //学生身份证号+密码=身份证后面的6个数来设置
            s.setStuIdCard(stuidcard);
            //学生姓名
            s.setStuName(name);
            //专业id
            s.setMajorId("");
            //专业名
            s.setMajorName("");
            //studentService.saveOrUpdate(s);
        }
    }

    @RequestMapping("saveall")
    public void test(){
        List<ManagerLogin> a=new ArrayList<>();
        for (int i = 0; i < 2; i++) {
            String aa = "q"+i;
            String bb = "b"+i;
            ManagerLogin m = new ManagerLogin();
            m.setMUsername(aa);
            m.setMPassword(bb);
            a.add(m);
        }


    }



}
